import {
  HTTP
}
from '../utils/http.js';

import {
  config
}
from '../config/config.js';

class UserModel extends HTTP {
  getLoginCode() {
    return this.login()
  }

  getAuthLoginByWeixin(p_code, p_userInfo) {
    return this.request({
      url: config.AuthLoginByWeixin,
      data: {
        code: p_code,
        userInfo: p_userInfo
      },
      method: 'POST'
    })
  }

  getOrderList() {
    return this.request({
      url: config.OrderList,
    })
  }

  getOrderDetail() {
    return this.request({
      url: config.OrderDetail,
    })
  }

  getOrderCancel() {
    return this.request({
      url: config.OrderCancel,
    })
  }

  getOrderExpress() {
    return this.request({
      url: config.OrderExpress,
    })
  }

  getCollectList() {
    return this.request({
      url: config.CollectList
    })
  }
  
  getCollectAddOrDelete(p_typeId, p_valueId) {
    return this.request({
      url: config.CollectAddOrDelete,
      data: {
        typeId: p_typeId,
        valueId: p_valueId
      },
      method: 'POST'
    })
  }

  getAddressList() {
    return this.request({
      url: config.AddressList,
    })
  }

  getAddressDetail(p_id) {
    return this.request({
      url: config.AddressDetail,
      data: {
        id: p_id
      }
    })
  }

  getAddressSave(p_id, p_name, p_mobile, p_province_id, p_city_id, p_district_id, p_address, p_is_default) {
    return this.request({
      url: config.AddressSave,
      data: {
        id: p_id,
        name: p_name,
        mobile: p_mobile,
        province_id: p_province_id,
        city_id: p_city_id,
        district_id: p_district_id,
        address: p_address,
        is_default: p_is_default
      },
      method: 'POST'
    })
  }

  getAddressDelete() {
    return this.request({
      url: config.AddressDelete,
    })
  }
}

export {
  UserModel
}